<template>
  <div class="LoginTest-container">
    <div>账号：<input type="text" v-model="loginAct"></div>
    <div>密码：<input type="password" v-model="loginPwd"></div>
    <button @click="login">登录</button>
  </div>
</template>

<script setup lang="ts" name="">
import axios from 'axios';
import { ref } from 'vue';

// type Props = {}
// defineProps<Props>()
// const emit = defineEmits([])
// const router = useRouter()
// const route = useRoute()
let loginAct = ref("")
let loginPwd = ref("")
function login() {
  console.log(loginAct.value, loginPwd.value);
  let formData = new FormData()
  formData.append("username", loginAct.value);
  formData.append("password", loginPwd.value);
  axios.post("http://localhost:8080/user/login", formData).then(res => {
    console.log(res);
    window.localStorage.setItem("token", res.data.data)
  }).catch(err => {
    console.log(err);
  })
}
</script>

<style scoped lang="scss">
.LoginTest-container {
  min-height: 100%;
}
</style>